package com.winning.devops.batch.reader.ch03.writer;

import com.winning.devops.batch.reader.ch03.domain.Customer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.item.ItemWriter;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author chensj
 * @date 2020-03-01 21:05
 */
@Component("fileItemReaderDemoItemWriter")
public class FileItemReaderDemoItemWriter implements ItemWriter<Customer> {
    /**
     * logger
     */
    private static final Logger logger = LoggerFactory.getLogger(FileItemReaderDemoItemWriter.class);

    @Override
    public void write(List<? extends Customer> list) throws Exception {
        if (list.size() > 0) {
            for (Customer customer : list) {
                logger.info("Customer {}", customer);
            }
        }
    }
}
